<?php defined('IN_PHPCMS') or exit('No permission resources.'); ?><?php 
$SEO['site_title'] = $q." - ".$SEO['site_title'];
$CATEGORYS = getcache('category_content_'.$siteid,'commons');
$MODEL = getcache('model','commons');
$modelid = $_GET['typeid'];
?>
<?php include template('content', 'header_page'); ?>
<div class="layui-warp">
  <div id="masonry" class="container-fluid">
    <?php $n=1; if(is_array($dat)) foreach($dat AS $i => $r) { ?>
    <div class="layui-box">
      <div class="layui-actions">
        <a class="layui-thumb" href="<?php echo $r['url'];?>" target="_blank"><img lay-src="<?php echo $r['thumb'];?>?x-oss-process=style/midpic" alt="<?php echo $r['title'];?>" /></a>
        <div class="layui-infos">
          <?php $enjoynum = isset($r['digg']) ? $r['digg'] : 0;?>
          <div class="layui-digg"><i class="layui-heart"></i><span class="layui-badge"><?php echo $enjoynum;?>人喜欢</span></div>
          <div class="layui-type"><i class="layui-icon">&#xe857;</i><span class="layui-badge"><a href="<?php echo $CATEGORYS[$r['catid']]['url'];?>" target="_blank"><?php echo $CATEGORYS[$r['catid']]['catname'];?></a></span></div>
        </div>  
      </div>
      <div class="layui-stats">
        <div class="layui-tips">
          <?php $db = pc_base::load_model('content_model');$db->table_name = $db->db_tablepre.$MODEL[$modelid]['tablename'].'_data';$_r = $db->get_one(array('id'=>$r[id])); $pictureurls = $_r[pictureurls]; ?>
          <?php $picnum = count(json_decode($pictureurls, true));?>
          <div class="layui-piccount"><i class="layui-icon">&#xe64a;</i><span class="layui-badge layui-count" data-num="<?php echo $picnum;?>"><?php echo $picnum;?>P</span></div>
          <div class="layui-posttime"><i class="layui-icon">&#xe609;</i><span class="layui-badge layui-date"><?php echo date("Y-m-d", $r[inputtime]);?></span></div>
        </div>
        <div class="layui-title">
          <h2><a href="<?php echo $r['url'];?>" title="<?php echo $r['title'];?>" target="_blank"><?php echo $r['title'];?></a></h2>
        </div>
      </div>
    </div>
    <?php $n++;}unset($n); ?>
  </div>
  <div class="layui-pagebox">
	<div class="layui-laypage"><?php echo $pages;?></div>
  </div>
</div>
<script type="text/javascript" src="<?php echo LAYUI_PATH;?>uaredirect.js"></script>
<script type="text/javascript">uaredirect("http://m.chunmeitu.com/search.html?q=<?php echo $q;?>");</script>
<?php if($page==1) { ?>
<script>
layui.use('layer', function(){
  var layer = layui.layer;
  layer.msg('关于&quot<?php echo $q;?>&quot共搜索到<?php echo $totalnums;?>条结果，用时<?php echo sprintf("%01.2f", $execute_time);?> 秒', {
  	icon: 1,
  	time: 2000 //2秒关闭（如果不配置，默认是3秒）
  });
});
</script>
<?php } ?>
<script>
layui.use('flow', function(){
  var flow = layui.flow;
  flow.lazyimg(); 
});
</script>
<?php include template('content', 'footer'); ?>
